/*
题目：对称二叉树
给你一个二叉树的根节点 root ， 检查它是否轴对称。
https://leetcode.cn/problems/symmetric-tree/
 */
public class IsSymmetric {
    public boolean judge(TreeNode leftChild, TreeNode rightChild) {
        if (leftChild == null && rightChild == null) return true;
        if (leftChild == null || rightChild == null) return false;
        return leftChild.val == rightChild.val && judge(leftChild.left,rightChild.right) && judge(leftChild.right,rightChild.left);
    }
    //判断左树的左等不等于右树的右
    public boolean isSymmetric(TreeNode root) {
        return judge(root.left,root.right);
    }
}
